<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "shbb_equip_type".
 *
 * @property integer $id
 * @property string $code
 * @property string $name_ch
 * @property string $name_en
 * @property string $image
 * @property string $comment
 * @property string $value_unit
 * @property integer $value_type
 *
 * @property ShbbEquip[] $shbbEquips
 */
class Equiptype extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'shbb_equip_type';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'value_type'], 'integer'],
            [['code', 'name_ch', 'name_en', 'image', 'comment', 'value_unit'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '设备ID',
            'code' => '设备编号',
            'name_ch' => '设备中文名称',
            'name_en' => '设备英文名称',
            'image' => '设备图片',
            'comment' => '备注',
            'value_unit' => '取值单位',
            'value_type' => '取值类型',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getShbbEquips()
    {
        return $this->hasMany(Equip::className(), ['equip_type_id' => 'id']);
    }
}
